<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="时间">
        <el-date-picker
          v-model="dateRange"
          size="small"
          style="width: 150px"
          value-format="yyyy-MM"
          type="month"
          placeholder="日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- <el-row>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['system:dict:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row> -->

    <el-table v-loading="loading" :data="reportList" >
      <el-table-column label="房号" align="center" prop="roomNumber" />
      <el-table-column label="台费（日）" align="center" prop="taiwanFeeDay" :show-overflow-tooltip="true" />
      <el-table-column label="台费（夜）" align="center" prop="taiwanFeeNight" :show-overflow-tooltip="true" />
      <el-table-column label="烟" align="center" prop="smoke" :show-overflow-tooltip="true" />
      <el-table-column label="饮料" align="center" prop="drinks" :show-overflow-tooltip="true" />
      <el-table-column label="零食" align="center" prop="retail" :show-overflow-tooltip="true" />
      <el-table-column label="餐饮" align="center" prop="restaurant" :show-overflow-tooltip="true" />
      <el-table-column label="折扣" align="center" prop="discount" :show-overflow-tooltip="true" />
      <el-table-column label="退款" align="center" prop="refund" :show-overflow-tooltip="true" />
      <el-table-column label="总计" align="center" prop="total" :show-overflow-tooltip="true" />
      <el-table-column label="今日支出" align="center" prop="expenditure" :show-overflow-tooltip="true" />
     
    </el-table>

  </div>
</template>

<script>
import { getMonthReportList } from "@/api/report/report";

export default {
  name: "monthReport",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 表格数据
      reportList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        dictName: undefined,
        dictType: undefined,
        status: undefined
      },
      // 日期范围
      dateRange: '',
      // 表单参数
      form: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询字典类型列表 */
    getList() {
      this.loading = true;
      getMonthReportList({"date":this.dateRange}).then(response => {
          this.reportList = response.rows;
          this.loading = false;
        }
      );
    },
    // 表单重置
    reset() {
      this.form = {
        dictId: undefined,
        dictName: undefined,
        dictType: undefined,
        status: "0",
        remark: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
        /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = '';
      this.resetForm("queryForm");
      this.handleQuery();
    },

    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有类型数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.exportLoading = true;
          return exportType(queryParams);
        }).then(response => {
          this.download(response.msg);
          this.exportLoading = false;
        })
    },
  }
};
</script>